import React, {Component} from 'react';
import {withRouter} from 'react-router-dom'
class Header extends Component {
    go=()=>{

        this.props.history.go(-2)
    }

    back = ()=>{
        this.props.history.goBack()
    }

    forward = ()=>{

        this.props.history.goForward()
    }
    render() {
        // console.log("Header组件接收的参数",this.props)
        return (
            <div className="page-header">
                <h2>React Router Demo</h2>
                <button onClick={this.forward}>前进</button>&nbsp;
                <button onClick={this.back}>后退</button>&nbsp;
                <button onClick={this.go}>go</button>
            </div>
        );
    }
}

export default withRouter(Header);
